<?php
/* tblOrderHeader */
class tblOrderHeader extends NocForm
	{
		protected $_ID                 = array();
		protected $_Customer                 = array();
		protected $_OrderDate                 = array();
		protected $_ShippedDate                 = array();
		protected $_InvoiceDate                 = array();
		protected $_PaidDate                 = array();
		protected $_OrderStatus                 = array();
		protected $_Courier                 = array();
		protected $_Freight                 = array();
		protected $_ShipName                 = array();
		protected $_ShipAddress                 = array();
		protected $_ShipAddress2                 = array();
		protected $_ShipCity                 = array();
		protected $_ShipRegion                 = array();
		protected $_ShipPostalCode                 = array();
		protected $_ShipCountry                 = array();
		protected $_ShipPhone                 = array();
		protected $_DeliveryName                 = array();
		protected $_DeliveryAddress                 = array();
		protected $_DeliveryAddress2                 = array();
		protected $_DeliveryCity                 = array();
		protected $_DeliveryRegion                 = array();
		protected $_DeliveryPostalCode                 = array();
		protected $_DeliveryCountry                 = array();
		protected $_OtherInfo                 = array();
		protected $_SalesChannel                 = array();

		function __construct()
		{
			parent::__construct();
			$this->getRow();
		}
		public function get_ID()
		{
				return  $this->_get_IDValue();
		}

		private function _get_IDValue()
		{
			if(isset($this->_ID['value']))
				return $this->_ID['value'];
			else
				return false;
		}

		public function get_Customer()
		{
				return  $this->_get_CustomerValue();
		}

		private function _get_CustomerValue()
		{
			if(isset($this->_Customer['value']))
				return $this->_Customer['value'];
			else
				return false;
		}

		public function get_OrderDate()
		{
				return  $this->_get_OrderDateValue();
		}

		private function _get_OrderDateValue()
		{
			if(isset($this->_OrderDate['value']))
				return $this->_OrderDate['value'];
			else
				return false;
		}

		public function get_ShippedDate()
		{
				return  $this->_get_ShippedDateValue();
		}

		private function _get_ShippedDateValue()
		{
			if(isset($this->_ShippedDate['value']))
				return $this->_ShippedDate['value'];
			else
				return false;
		}

		public function get_InvoiceDate()
		{
				return  $this->_get_InvoiceDateValue();
		}

		private function _get_InvoiceDateValue()
		{
			if(isset($this->_InvoiceDate['value']))
				return $this->_InvoiceDate['value'];
			else
				return false;
		}

		public function get_PaidDate()
		{
				return  $this->_get_PaidDateValue();
		}

		private function _get_PaidDateValue()
		{
			if(isset($this->_PaidDate['value']))
				return $this->_PaidDate['value'];
			else
				return false;
		}

		public function get_OrderStatus()
		{
				return  $this->_get_OrderStatusValue();
		}

		private function _get_OrderStatusValue()
		{
			if(isset($this->_OrderStatus['value']))
				return $this->_OrderStatus['value'];
			else
				return false;
		}

		public function get_Courier()
		{
				return  $this->_get_CourierValue();
		}

		private function _get_CourierValue()
		{
			if(isset($this->_Courier['value']))
				return $this->_Courier['value'];
			else
				return false;
		}

		public function get_Freight()
		{
				return  $this->_get_FreightValue();
		}

		private function _get_FreightValue()
		{
			if(isset($this->_Freight['value']))
				return $this->_Freight['value'];
			else
				return false;
		}

		public function get_ShipName()
		{
				return  $this->_get_ShipNameValue();
		}

		private function _get_ShipNameValue()
		{
			if(isset($this->_ShipName['value']))
				return $this->_ShipName['value'];
			else
				return false;
		}

		public function get_ShipAddress()
		{
				return  $this->_get_ShipAddressValue();
		}

		private function _get_ShipAddressValue()
		{
			if(isset($this->_ShipAddress['value']))
				return $this->_ShipAddress['value'];
			else
				return false;
		}

		public function get_ShipAddress2()
		{
				return  $this->_get_ShipAddress2Value();
		}

		private function _get_ShipAddress2Value()
		{
			if(isset($this->_ShipAddress2['value']))
				return $this->_ShipAddress2['value'];
			else
				return false;
		}

		public function get_ShipCity()
		{
				return  $this->_get_ShipCityValue();
		}

		private function _get_ShipCityValue()
		{
			if(isset($this->_ShipCity['value']))
				return $this->_ShipCity['value'];
			else
				return false;
		}

		public function get_ShipRegion()
		{
				return  $this->_get_ShipRegionValue();
		}

		private function _get_ShipRegionValue()
		{
			if(isset($this->_ShipRegion['value']))
				return $this->_ShipRegion['value'];
			else
				return false;
		}

		public function get_ShipPostalCode()
		{
				return  $this->_get_ShipPostalCodeValue();
		}

		private function _get_ShipPostalCodeValue()
		{
			if(isset($this->_ShipPostalCode['value']))
				return $this->_ShipPostalCode['value'];
			else
				return false;
		}

		public function get_ShipCountry()
		{
				return  $this->_get_ShipCountryValue();
		}

		private function _get_ShipCountryValue()
		{
			if(isset($this->_ShipCountry['value']))
				return $this->_ShipCountry['value'];
			else
				return false;
		}

		public function get_ShipPhone()
		{
				return  $this->_get_ShipPhoneValue();
		}

		private function _get_ShipPhoneValue()
		{
			if(isset($this->_ShipPhone['value']))
				return $this->_ShipPhone['value'];
			else
				return false;
		}

		public function get_DeliveryName()
		{
				return  $this->_get_DeliveryNameValue();
		}

		private function _get_DeliveryNameValue()
		{
			if(isset($this->_DeliveryName['value']))
				return $this->_DeliveryName['value'];
			else
				return false;
		}

		public function get_DeliveryAddress()
		{
				return  $this->_get_DeliveryAddressValue();
		}

		private function _get_DeliveryAddressValue()
		{
			if(isset($this->_DeliveryAddress['value']))
				return $this->_DeliveryAddress['value'];
			else
				return false;
		}

		public function get_DeliveryAddress2()
		{
				return  $this->_get_DeliveryAddress2Value();
		}

		private function _get_DeliveryAddress2Value()
		{
			if(isset($this->_DeliveryAddress2['value']))
				return $this->_DeliveryAddress2['value'];
			else
				return false;
		}

		public function get_DeliveryCity()
		{
				return  $this->_get_DeliveryCityValue();
		}

		private function _get_DeliveryCityValue()
		{
			if(isset($this->_DeliveryCity['value']))
				return $this->_DeliveryCity['value'];
			else
				return false;
		}

		public function get_DeliveryRegion()
		{
				return  $this->_get_DeliveryRegionValue();
		}

		private function _get_DeliveryRegionValue()
		{
			if(isset($this->_DeliveryRegion['value']))
				return $this->_DeliveryRegion['value'];
			else
				return false;
		}

		public function get_DeliveryPostalCode()
		{
				return  $this->_get_DeliveryPostalCodeValue();
		}

		private function _get_DeliveryPostalCodeValue()
		{
			if(isset($this->_DeliveryPostalCode['value']))
				return $this->_DeliveryPostalCode['value'];
			else
				return false;
		}

		public function get_DeliveryCountry()
		{
				return  $this->_get_DeliveryCountryValue();
		}

		private function _get_DeliveryCountryValue()
		{
			if(isset($this->_DeliveryCountry['value']))
				return $this->_DeliveryCountry['value'];
			else
				return false;
		}

		public function get_OtherInfo()
		{
				return  $this->_get_OtherInfoValue();
		}

		private function _get_OtherInfoValue()
		{
			if(isset($this->_OtherInfo['value']))
				return $this->_OtherInfo['value'];
			else
				return false;
		}

		public function get_SalesChannel()
		{
				return  $this->_get_SalesChannelValue();
		}

		private function _get_SalesChannelValue()
		{
			if(isset($this->_SalesChannel['value']))
				return $this->_SalesChannel['value'];
			else
				return false;
		}


		public function set_IDValue($strID)
		{
			if($this->validateInput("validatexxxxx", $strID, "ID "))
					return($this->_setNewValue($this->_ID, $strID));
			else
					return false;
		}

		public function set_CustomerValue($strCustomer)
		{
			if($this->validateInput("validatexxxxx", $strCustomer, "Customer "))
					return($this->_setNewValue($this->_Customer, $strCustomer));
			else
					return false;
		}

		public function set_OrderDateValue($strOrderDate)
		{
			if($this->validateInput("validatexxxxx", $strOrderDate, "OrderDate "))
					return($this->_setNewValue($this->_OrderDate, $strOrderDate));
			else
					return false;
		}

		public function set_ShippedDateValue($strShippedDate)
		{
			if($this->validateInput("validatexxxxx", $strShippedDate, "ShippedDate "))
					return($this->_setNewValue($this->_ShippedDate, $strShippedDate));
			else
					return false;
		}

		public function set_InvoiceDateValue($strInvoiceDate)
		{
			if($this->validateInput("validatexxxxx", $strInvoiceDate, "InvoiceDate "))
					return($this->_setNewValue($this->_InvoiceDate, $strInvoiceDate));
			else
					return false;
		}

		public function set_PaidDateValue($strPaidDate)
		{
			if($this->validateInput("validatexxxxx", $strPaidDate, "PaidDate "))
					return($this->_setNewValue($this->_PaidDate, $strPaidDate));
			else
					return false;
		}

		public function set_OrderStatusValue($strOrderStatus)
		{
			if($this->validateInput("validatexxxxx", $strOrderStatus, "OrderStatus "))
					return($this->_setNewValue($this->_OrderStatus, $strOrderStatus));
			else
					return false;
		}

		public function set_CourierValue($strCourier)
		{
			if($this->validateInput("validatexxxxx", $strCourier, "Courier "))
					return($this->_setNewValue($this->_Courier, $strCourier));
			else
					return false;
		}

		public function set_FreightValue($strFreight)
		{
			if($this->validateInput("validatexxxxx", $strFreight, "Freight "))
					return($this->_setNewValue($this->_Freight, $strFreight));
			else
					return false;
		}

		public function set_ShipNameValue($strShipName)
		{
			if($this->validateInput("validatexxxxx", $strShipName, "ShipName "))
					return($this->_setNewValue($this->_ShipName, $strShipName));
			else
					return false;
		}

		public function set_ShipAddressValue($strShipAddress)
		{
			if($this->validateInput("validatexxxxx", $strShipAddress, "ShipAddress "))
					return($this->_setNewValue($this->_ShipAddress, $strShipAddress));
			else
					return false;
		}

		public function set_ShipAddress2Value($strShipAddress2)
		{
			if($this->validateInput("validatexxxxx", $strShipAddress2, "ShipAddress2 "))
					return($this->_setNewValue($this->_ShipAddress2, $strShipAddress2));
			else
					return false;
		}

		public function set_ShipCityValue($strShipCity)
		{
			if($this->validateInput("validatexxxxx", $strShipCity, "ShipCity "))
					return($this->_setNewValue($this->_ShipCity, $strShipCity));
			else
					return false;
		}

		public function set_ShipRegionValue($strShipRegion)
		{
			if($this->validateInput("validatexxxxx", $strShipRegion, "ShipRegion "))
					return($this->_setNewValue($this->_ShipRegion, $strShipRegion));
			else
					return false;
		}

		public function set_ShipPostalCodeValue($strShipPostalCode)
		{
			if($this->validateInput("validatexxxxx", $strShipPostalCode, "ShipPostalCode "))
					return($this->_setNewValue($this->_ShipPostalCode, $strShipPostalCode));
			else
					return false;
		}

		public function set_ShipCountryValue($strShipCountry)
		{
			if($this->validateInput("validatexxxxx", $strShipCountry, "ShipCountry "))
					return($this->_setNewValue($this->_ShipCountry, $strShipCountry));
			else
					return false;
		}

		public function set_ShipPhoneValue($strShipPhone)
		{
			if($this->validateInput("validatexxxxx", $strShipPhone, "ShipPhone "))
					return($this->_setNewValue($this->_ShipPhone, $strShipPhone));
			else
					return false;
		}

		public function set_DeliveryNameValue($strDeliveryName)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryName, "DeliveryName "))
					return($this->_setNewValue($this->_DeliveryName, $strDeliveryName));
			else
					return false;
		}

		public function set_DeliveryAddressValue($strDeliveryAddress)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryAddress, "DeliveryAddress "))
					return($this->_setNewValue($this->_DeliveryAddress, $strDeliveryAddress));
			else
					return false;
		}

		public function set_DeliveryAddress2Value($strDeliveryAddress2)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryAddress2, "DeliveryAddress2 "))
					return($this->_setNewValue($this->_DeliveryAddress2, $strDeliveryAddress2));
			else
					return false;
		}

		public function set_DeliveryCityValue($strDeliveryCity)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryCity, "DeliveryCity "))
					return($this->_setNewValue($this->_DeliveryCity, $strDeliveryCity));
			else
					return false;
		}

		public function set_DeliveryRegionValue($strDeliveryRegion)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryRegion, "DeliveryRegion "))
					return($this->_setNewValue($this->_DeliveryRegion, $strDeliveryRegion));
			else
					return false;
		}

		public function set_DeliveryPostalCodeValue($strDeliveryPostalCode)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryPostalCode, "DeliveryPostalCode "))
					return($this->_setNewValue($this->_DeliveryPostalCode, $strDeliveryPostalCode));
			else
					return false;
		}

		public function set_DeliveryCountryValue($strDeliveryCountry)
		{
			if($this->validateInput("validatexxxxx", $strDeliveryCountry, "DeliveryCountry "))
					return($this->_setNewValue($this->_DeliveryCountry, $strDeliveryCountry));
			else
					return false;
		}

		public function set_OtherInfoValue($strOtherInfo)
		{
			if($this->validateInput("validatexxxxx", $strOtherInfo, "OtherInfo "))
					return($this->_setNewValue($this->_OtherInfo, $strOtherInfo));
			else
					return false;
		}

		public function set_SalesChannelValue($strSalesChannel)
		{
			if($this->validateInput("validatexxxxx", $strSalesChannel, "SalesChannel "))
					return($this->_setNewValue($this->_SalesChannel, $strSalesChannel));
			else
					return false;
		}
		public function update()
		{
			if($this->_boFailedValidation)
					return false;
					$strErrorMsg = "";
					$strSuccessMsg = "";
			if($this->get_ID() == "")
					return $this->_setFailScreens("Update aborted no record selected.", true);

			$strJoin = "";
			$strSql = "UPDATE tblOrderHeader
					SET ";
					if($this->_ID['updated'])
					{
						$strSql .= $strJoin." ID = '".$this->_ID['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ID['oldvalue']."' to '".$this->_ID['value']."'<br/>";
						$strErrorMsg .= "ID not updated<br/>";					}

					if($this->_Customer['updated'])
					{
						$strSql .= $strJoin." Customer = '".$this->_Customer['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_Customer['oldvalue']."' to '".$this->_Customer['value']."'<br/>";
						$strErrorMsg .= "Customer not updated<br/>";					}

					if($this->_OrderDate['updated'])
					{
						$strSql .= $strJoin." OrderDate = '".$this->_OrderDate['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_OrderDate['oldvalue']."' to '".$this->_OrderDate['value']."'<br/>";
						$strErrorMsg .= "OrderDate not updated<br/>";					}

					if($this->_ShippedDate['updated'])
					{
						$strSql .= $strJoin." ShippedDate = '".$this->_ShippedDate['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShippedDate['oldvalue']."' to '".$this->_ShippedDate['value']."'<br/>";
						$strErrorMsg .= "ShippedDate not updated<br/>";					}

					if($this->_InvoiceDate['updated'])
					{
						$strSql .= $strJoin." InvoiceDate = '".$this->_InvoiceDate['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_InvoiceDate['oldvalue']."' to '".$this->_InvoiceDate['value']."'<br/>";
						$strErrorMsg .= "InvoiceDate not updated<br/>";					}

					if($this->_PaidDate['updated'])
					{
						$strSql .= $strJoin." PaidDate = '".$this->_PaidDate['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_PaidDate['oldvalue']."' to '".$this->_PaidDate['value']."'<br/>";
						$strErrorMsg .= "PaidDate not updated<br/>";					}

					if($this->_OrderStatus['updated'])
					{
						$strSql .= $strJoin." OrderStatus = '".$this->_OrderStatus['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_OrderStatus['oldvalue']."' to '".$this->_OrderStatus['value']."'<br/>";
						$strErrorMsg .= "OrderStatus not updated<br/>";					}

					if($this->_Courier['updated'])
					{
						$strSql .= $strJoin." Courier = '".$this->_Courier['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_Courier['oldvalue']."' to '".$this->_Courier['value']."'<br/>";
						$strErrorMsg .= "Courier not updated<br/>";					}

					if($this->_Freight['updated'])
					{
						$strSql .= $strJoin." Freight = '".$this->_Freight['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_Freight['oldvalue']."' to '".$this->_Freight['value']."'<br/>";
						$strErrorMsg .= "Freight not updated<br/>";					}

					if($this->_ShipName['updated'])
					{
						$strSql .= $strJoin." ShipName = '".$this->_ShipName['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipName['oldvalue']."' to '".$this->_ShipName['value']."'<br/>";
						$strErrorMsg .= "ShipName not updated<br/>";					}

					if($this->_ShipAddress['updated'])
					{
						$strSql .= $strJoin." ShipAddress = '".$this->_ShipAddress['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipAddress['oldvalue']."' to '".$this->_ShipAddress['value']."'<br/>";
						$strErrorMsg .= "ShipAddress not updated<br/>";					}

					if($this->_ShipAddress2['updated'])
					{
						$strSql .= $strJoin." ShipAddress2 = '".$this->_ShipAddress2['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipAddress2['oldvalue']."' to '".$this->_ShipAddress2['value']."'<br/>";
						$strErrorMsg .= "ShipAddress2 not updated<br/>";					}

					if($this->_ShipCity['updated'])
					{
						$strSql .= $strJoin." ShipCity = '".$this->_ShipCity['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipCity['oldvalue']."' to '".$this->_ShipCity['value']."'<br/>";
						$strErrorMsg .= "ShipCity not updated<br/>";					}

					if($this->_ShipRegion['updated'])
					{
						$strSql .= $strJoin." ShipRegion = '".$this->_ShipRegion['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipRegion['oldvalue']."' to '".$this->_ShipRegion['value']."'<br/>";
						$strErrorMsg .= "ShipRegion not updated<br/>";					}

					if($this->_ShipPostalCode['updated'])
					{
						$strSql .= $strJoin." ShipPostalCode = '".$this->_ShipPostalCode['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipPostalCode['oldvalue']."' to '".$this->_ShipPostalCode['value']."'<br/>";
						$strErrorMsg .= "ShipPostalCode not updated<br/>";					}

					if($this->_ShipCountry['updated'])
					{
						$strSql .= $strJoin." ShipCountry = '".$this->_ShipCountry['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipCountry['oldvalue']."' to '".$this->_ShipCountry['value']."'<br/>";
						$strErrorMsg .= "ShipCountry not updated<br/>";					}

					if($this->_ShipPhone['updated'])
					{
						$strSql .= $strJoin." ShipPhone = '".$this->_ShipPhone['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_ShipPhone['oldvalue']."' to '".$this->_ShipPhone['value']."'<br/>";
						$strErrorMsg .= "ShipPhone not updated<br/>";					}

					if($this->_DeliveryName['updated'])
					{
						$strSql .= $strJoin." DeliveryName = '".$this->_DeliveryName['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryName['oldvalue']."' to '".$this->_DeliveryName['value']."'<br/>";
						$strErrorMsg .= "DeliveryName not updated<br/>";					}

					if($this->_DeliveryAddress['updated'])
					{
						$strSql .= $strJoin." DeliveryAddress = '".$this->_DeliveryAddress['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryAddress['oldvalue']."' to '".$this->_DeliveryAddress['value']."'<br/>";
						$strErrorMsg .= "DeliveryAddress not updated<br/>";					}

					if($this->_DeliveryAddress2['updated'])
					{
						$strSql .= $strJoin." DeliveryAddress2 = '".$this->_DeliveryAddress2['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryAddress2['oldvalue']."' to '".$this->_DeliveryAddress2['value']."'<br/>";
						$strErrorMsg .= "DeliveryAddress2 not updated<br/>";					}

					if($this->_DeliveryCity['updated'])
					{
						$strSql .= $strJoin." DeliveryCity = '".$this->_DeliveryCity['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryCity['oldvalue']."' to '".$this->_DeliveryCity['value']."'<br/>";
						$strErrorMsg .= "DeliveryCity not updated<br/>";					}

					if($this->_DeliveryRegion['updated'])
					{
						$strSql .= $strJoin." DeliveryRegion = '".$this->_DeliveryRegion['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryRegion['oldvalue']."' to '".$this->_DeliveryRegion['value']."'<br/>";
						$strErrorMsg .= "DeliveryRegion not updated<br/>";					}

					if($this->_DeliveryPostalCode['updated'])
					{
						$strSql .= $strJoin." DeliveryPostalCode = '".$this->_DeliveryPostalCode['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryPostalCode['oldvalue']."' to '".$this->_DeliveryPostalCode['value']."'<br/>";
						$strErrorMsg .= "DeliveryPostalCode not updated<br/>";					}

					if($this->_DeliveryCountry['updated'])
					{
						$strSql .= $strJoin." DeliveryCountry = '".$this->_DeliveryCountry['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_DeliveryCountry['oldvalue']."' to '".$this->_DeliveryCountry['value']."'<br/>";
						$strErrorMsg .= "DeliveryCountry not updated<br/>";					}

					if($this->_OtherInfo['updated'])
					{
						$strSql .= $strJoin." OtherInfo = '".$this->_OtherInfo['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_OtherInfo['oldvalue']."' to '".$this->_OtherInfo['value']."'<br/>";
						$strErrorMsg .= "OtherInfo not updated<br/>";					}

					if($this->_SalesChannel['updated'])
					{
						$strSql .= $strJoin." SalesChannel = '".$this->_SalesChannel['value']."' ";
						$strJoin = ",";
						$strSuccessMsg .= "Portal Address changed from '".$this->_SalesChannel['oldvalue']."' to '".$this->_SalesChannel['value']."'<br/>";
						$strErrorMsg .= "SalesChannel not updated<br/>";					}

			$strSql .= "WHERE ID = ". $this->get_ID();
			//Only execute sql if there is something to update.
			if($strJoin == ",")
			{
				//echo nl2br($strSql);
				if(!($DatabaseResult = mysql_query($strSql)))
					return $this->_setFailScreens($strErrorMsg);
				$GLOBALS['arrSuccessMessages'][] = $strSuccessMsg;
			}else
				$GLOBALS['arrSuccessMessages'][] = "No data hasn't changed so no updates made.";
			return(TRUE);
		}
			public function delete_tblOrderHeader()
			{
				if($this->get_IDValue() == "")
					return $this->_setFailScreens("Delete aborted no record selected.", true);
				
		
				/* Deleted port forward from agg */
				$strSql =   "DELETE FROM tblOrderHeader
		   					  WHERE ID		= ".$this->get_IDValue();
		
				$qryDeletetblOrderHeader = new MySqlResults($strSql);
		
				if(!$qryDeletetblOrderHeader->result)
					return ($this->_setFailScreens("An error occurred while trying to delete database entry."));
		
		
				$GLOBALS['arrSuccessMessages'][] = " has been removed";
				return true;
			}
		public function insert_tblOrderHeader()
		{
			/* Check that all required fields have been set */
			if (!($this->_validateAllFieldsSet()))
			{
				return ($this->_setFailScreens("Fields required to add a new record haven't all been set", true));
			}
			
			$strSql =   "INSERT INTO tblOrderHeader
						  (
		 	Customer

		, 	OrderDate

		, 	ShippedDate

		, 	InvoiceDate

		, 	PaidDate

		, 	OrderStatus

		, 	Courier

		, 	Freight

		, 	ShipName

		, 	ShipAddress

		, 	ShipAddress2

		, 	ShipCity

		, 	ShipRegion

		, 	ShipPostalCode

		, 	ShipCountry

		, 	ShipPhone

		, 	DeliveryName

		, 	DeliveryAddress

		, 	DeliveryAddress2

		, 	DeliveryCity

		, 	DeliveryRegion

		, 	DeliveryPostalCode

		, 	DeliveryCountry

		, 	OtherInfo

		, 	SalesChannel
)VALUE(
		 	$this->get_CustomerValue() 
		, 	$this->get_OrderDateValue() 
		, 	$this->get_ShippedDateValue() 
		, 	$this->get_InvoiceDateValue() 
		, 	$this->get_PaidDateValue() 
		, 	$this->get_OrderStatusValue() 
		, 	$this->get_CourierValue() 
		, 	$this->get_FreightValue() 
		, 	$this->get_ShipNameValue() 
		, 	$this->get_ShipAddressValue() 
		, 	$this->get_ShipAddress2Value() 
		, 	$this->get_ShipCityValue() 
		, 	$this->get_ShipRegionValue() 
		, 	$this->get_ShipPostalCodeValue() 
		, 	$this->get_ShipCountryValue() 
		, 	$this->get_ShipPhoneValue() 
		, 	$this->get_DeliveryNameValue() 
		, 	$this->get_DeliveryAddressValue() 
		, 	$this->get_DeliveryAddress2Value() 
		, 	$this->get_DeliveryCityValue() 
		, 	$this->get_DeliveryRegionValue() 
		, 	$this->get_DeliveryPostalCodeValue() 
		, 	$this->get_DeliveryCountryValue() 
		, 	$this->get_OtherInfoValue() 
		, 	$this->get_SalesChannelValue() 
			)";
			
			$qryInserttblOrderHeader = new MySqlResults($strSql);
		if ($qryInserttblOrderHeader->result)
		{
			/*Extra post sql processing  */
		}else
			return $this->_setFailScreens("Unable to add to  tblOrderHeader");
			
		return true;
	}
	}

?>